<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreatePhotosTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('photos', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('uid')->default(0);
            $table->string('title', 50);
            $table->text('image')->nullable();
            $table->integer('openstate')->default(0);
            $table->string('desc', 191);
            $table->integer('category_id')->default(0);
            $table->string('tags', 191);
            $table->index('title');
            $table->index('tags');
            $table->index(['title', 'category_id', 'tags']);
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('photos');
    }
}
